//
//  ProjectVC.swift
//  DoctorVisits
//
//  Created by lanou3g on 16/3/1.
//  Copyright © 2016年 SHH. All rights reserved.
//

import UIKit

class ProjectVC: UIViewController {
    
    
    var infoImageV:UIImageView? //影视图片
    var star:UILabel?  // 星星
    var numberL:UILabel? //剧集数
    var grade:UILabel?//评分
    var actors:UILabel?//主演
    var actorsS:UILabel?//主演人员
    var yearL:UILabel?//年份
    var time:UILabel? //时间
    var sourceL:UILabel?//播放来源
    var sourceBtn:UIButton?//播放来源选项
    var showImageV:UIImageView?//小图标
    var playBtn:UIButton?//播放
    var menuV:UIView?//菜单

    

    override func viewDidLoad() {
        super.viewDidLoad()

        addViews()
    }

    func addViews(){
        
        infoImageV = UIImageView(frame: CGRectMake(self.view.frame.size.width*0.03, self.view.frame.size.height*0.1, self.view.frame.size.width*0.3, self.view.frame.size.height*0.23))
        infoImageV?.backgroundColor = UIColor.redColor()
        self.view.addSubview(infoImageV!)
        
        numberL = UILabel(frame: CGRectMake(0,(self.infoImageV?.frame.size.height)!*0.83,(self.infoImageV?.frame.size.width)!,(self.infoImageV?.frame.size.height)!*0.17))
        numberL?.text = "37集全"
        numberL?.backgroundColor = UIColor.whiteColor()
        numberL?.alpha = 0.7
        numberL?.textAlignment = .Right
        numberL?.font = UIFont.systemFontOfSize(13)
        infoImageV?.addSubview(numberL!)
        
        star = UILabel(frame: CGRectMake(self.view.frame.size.width*0.38,self.view.frame.size.height*0.1, self.view.frame.size.width*0.32, self.view.frame.size.height*0.03))
        star?.text = "✨✨✨✨✨"
        //        star?.textAlignment = .Center
        star?.font = UIFont.systemFontOfSize(13)
        //        star?.backgroundColor = UIColor.purpleColor()
        self.view.addSubview(star!)
        
        grade = UILabel(frame: CGRectMake(self.view.frame.size.width*0.64,self.view.frame.size.height*0.1005,self.view.frame.size.width*0.25,self.view.frame.size.height*0.03))
        grade?.text = "9.8"
        grade?.textAlignment = .Left
        grade?.transform = CGAffineTransformMakeRotation(0.1)
        grade?.font = UIFont.systemFontOfSize(23, weight: 0)
        //        grade?.backgroundColor = UIColor.greenColor()
        self.view.addSubview(grade!)
        
        actors = UILabel(frame: CGRectMake(self.view.frame.size.width*0.38,self.view.frame.size.height*0.14,self.view.frame.size.width*0.1,self.view.frame.size.height*0.03))
        actors?.text = "主演:"
        actors?.font = UIFont.systemFontOfSize(13)
        //        actors?.backgroundColor = UIColor.blueColor()
        self.view.addSubview(actors!)
        
        actorsS = UILabel(frame: CGRectMake(self.view.frame.size.width*0.46,self.view.frame.size.height*0.14,self.view.frame.size.width*0.42,self.view.frame.size.height*0.03))
        actorsS?.text = "刘恺威,郑爽,米雪,张彬彬,涨涨涨"
        actorsS?.font = UIFont.systemFontOfSize(13)
        self.view.addSubview(actorsS!)
        
        yearL = UILabel(frame: CGRectMake(self.view.frame.size.width*0.38,self.view.frame.size.height*0.18,self.view.frame.size.width*0.1,self.view.frame.size.height*0.03))
        yearL?.text = "年份:"
        yearL?.font = UIFont.systemFontOfSize(13)
        self.view.addSubview(yearL!)
        
        time = UILabel(frame: CGRectMake(self.view.frame.size.width*0.48,self.view.frame.size.height*0.18,self.view.frame.size.width*0.42,self.view.frame.size.height*0.03))
        time?.text = "2016-02-01"
        time?.font = UIFont.systemFontOfSize(13)
        self.view.addSubview(time!)
        
        
        sourceL = UILabel(frame: CGRectMake(self.view.frame.size.width*0.38,self.view.frame.size.height*0.22,self.view.frame.size.width*0.15,self.view.frame.size.height*0.03))
        sourceL?.text = "播放来源"
        sourceL?.font = UIFont.systemFontOfSize(13)
        //        sourceL?.backgroundColor = UIColor.redColor()
        self.view.addSubview(sourceL!)
        
        
        sourceBtn = UIButton(frame: CGRectMake(self.view.frame.size.width*0.55,self.view.frame.size.height*0.22,self.view.frame.size.width*0.35,self.view.frame.size.height*0.03))
        sourceBtn?.setTitle("乐视网     ⊿", forState: UIControlState.Normal)
        sourceBtn?.addTarget(self, action: Selector("pullAction"), forControlEvents: UIControlEvents.TouchUpInside)
        sourceBtn?.titleLabel!.font = UIFont.systemFontOfSize(13)
        //        sourceBtn?.backgroundColor = UIColor.yellowColor()
        sourceBtn?.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        self.view.addSubview(sourceBtn!)
        
        
        showImageV = UIImageView(frame: CGRectMake((self.sourceBtn?.frame.size.width)!*0.12, 0, (self.sourceBtn?.frame.size.width)!*0.15, (self.sourceBtn?.frame.size.height)!))
        showImageV?.image = UIImage(named: "play_logo_letv")
        sourceBtn?.addSubview(showImageV!)
        
        playBtn = UIButton(frame: CGRectMake(self.view.frame.size.width*0.38,self.view.frame.size.height*0.268,self.view.frame.size.width*0.2,self.view.frame.size.height*0.06))
        playBtn?.backgroundColor = UIColor.blueColor()
        playBtn?.setTitle("播放", forState: UIControlState.Normal)
        playBtn?.titleLabel?.font = UIFont.systemFontOfSize(20)
        self.view.addSubview(playBtn!)
        

        
    }
    
    
    func pullAction() -> Void{
        
        menuV = UIView(frame: CGRectMake(self.view.frame.size.width*0.7,self.view.frame.size.height*0.25,self.view.frame.size.width*0.28,self.view.frame.size.height*0.15))
        menuV?.backgroundColor = UIColor.grayColor()
        
        self.view.addSubview(menuV!)
        
        
        sourceBtn?.removeFromSuperview()
        showImageV?.removeFromSuperview()
        sourceBtn = UIButton(frame: CGRectMake(self.view.frame.size.width*0.55,self.view.frame.size.height*0.22,self.view.frame.size.width*0.35,self.view.frame.size.height*0.03))
        sourceBtn?.setTitle("乐视网     ⊿", forState: UIControlState.Normal)
        sourceBtn?.addTarget(self, action: Selector("backAction"), forControlEvents: UIControlEvents.TouchUpInside)
        sourceBtn?.titleLabel!.font = UIFont.systemFontOfSize(13)
        //        sourceBtn?.backgroundColor = UIColor.yellowColor()
        sourceBtn?.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        self.view.addSubview(sourceBtn!)
        showImageV = UIImageView(frame: CGRectMake((self.sourceBtn?.frame.size.width)!*0.12, 0, (self.sourceBtn?.frame.size.width)!*0.15, (self.sourceBtn?.frame.size.height)!))
        showImageV?.image = UIImage(named: "play_logo_letv")
        sourceBtn?.addSubview(showImageV!)
        
        
    }
    
    func ProjectVCAction() ->Void{
        menuV?.removeFromSuperview()
        sourceBtn?.addTarget(self, action: Selector("pullAction"), forControlEvents: UIControlEvents.TouchUpInside)
        
    }
    

    
    
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
